#ifndef __MOTOR_H
#define __MOTOR_H

/*---------------C Scope-----------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif


#ifdef __cplusplus
}
#include "driver/DRV8701E_RT1064.h"
#include "Algorithm/PID/PID.h"
#include "gpio/ADC_RT1064.h"
#include "Device/encoder/Encoder_RT1064.h"
typedef enum{
    NORMAL=0,
    REVERSE=1
} Order;

class Motor
{
private:
    float speed;
    float target_speed;

    Order order; 
    void UpdateSpeed();

public:
    Motor(DRV8701E_RT1064* _driver,ADC_RT1064* _current_sample,Encoder* _encoder):
    driver(_driver),current_sample(_current_sample),encoder(_encoder)
    { 

    }

    DRV8701E_RT1064* driver;
    ADC_RT1064* current_sample;
    Encoder* encoder;
    
    PID_Controller speedLoop;
    PID_Controller currentLoop; 

    void Init();
    void Adjust();
    void Update(float _target_speed);
    void Acuate();
    int32_t GetSpeed();
    float GetCurrent();
	
};

#endif
#endif
